import { Http,Util } from '@/utils';
import TaskServiceBase from './task-service-base';


/**
 * 任务服务对象
 *
 * @export
 * @class TaskService
 * @extends {TaskServiceBase}
 */
export default class TaskService extends TaskServiceBase {

    /**
     * Creates an instance of  TaskService.
     * 
     * @param {*} [opts={}]
     * @memberof  TaskService
     */
    constructor(opts: any = {}) {
        super(opts);
    }


    /**
     * searchTaskByTaskId接口方法
     * @param url
     * @param data
     * @param isloading
     */
    async searchTaskByTaskId(url:string,data: any = {}, isloading?: boolean): Promise<any> {

        let res:any = await Http.getInstance().get(url, data, isloading);
        return res;
    }


    /**
     * FetchTaskTeam接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof UserServiceBase
     */
    public async FetchTaskTeam(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res: any = await Http.getInstance().get(`/users/fetchtaskteam`, tempData, isloading);
        return res;
    }


    /**
     * FetchDefault接口方法
     *
     * @param {*} [context={}]
     * @param {*} [data={}]
     * @param {boolean} [isloading]
     * @returns {Promise<any>}
     * @memberof UserServiceBase
     */
    public async UserFetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/users/fetchdefault`,tempData,isloading);
        return res;
    }


    /**
     * 获取任务附件
     * @param context
     * @param data
     * @param isloading
     */
    public async getFileList(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().get(`/files/fetchtype`,tempData,isloading);
        return res;
    }


    /**
     * 删除附件
     * @param context
     * @param data
     * @param isloading
     */
    public async deleteFileList(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
        let tempData:any = JSON.parse(JSON.stringify(data));
        let res:any = Http.getInstance().delete(`/files/${context.fileid}`,tempData,isloading);
        return res;
    }



}